import 'whatwg-fetch'
import 'es6-promise'

/**
 * 请求参数封装
 * @param  {[type]} paramsObj [description]
 * @return {[type]}           [description]
 */
 function getParams(paramsObj){
 	var params = ''
 	if (paramsObj) {
 		params += '?'
 		for(var key in paramsObj){
 			params += ( key +'='+ paramsObj[key] + '&' )
 		}
 	}
 	return params
 }


 export function get(url,paramsObj) {
 	url +=  getParams(paramsObj)
 	var result = fetch(url, {
 		credentials: 'include',
 		headers: {
 			'Accept': 'application/json, text/plain, */*'
 		}
 	});

 	return result;
 }
